//
//  SAProductChooseColorCell.m
//  yidiantong
//
//  Created by 黄志刚 on 2020/10/13.
//

#import "SAProductChooseColorCell.h"

@interface SAProductChooseColorCell()

@property (weak, nonatomic)  UIImageView *iconImageView;
@property (weak, nonatomic)  UIView *mongoliaView;
@property (weak, nonatomic)  UIImageView *countImageView;
@property (weak, nonatomic)  UILabel *countLabel;

@end
@implementation SAProductChooseColorCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if(self  =[super initWithFrame:frame])
    {
        
        [self setUpsUbViews];
    }
    return self;
}
-(void)setUpsUbViews
{
    self.contentView.backgroundColor = [UIColor clearColor];

    UIView *mongoliaView = [[UIView alloc] init];
    mongoliaView.layer.masksToBounds = YES;
    mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    [self.contentView addSubview:mongoliaView];
    self.mongoliaView = mongoliaView;
    [mongoliaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(0));
        make.top.equalTo(@(0));
        make.width.mas_equalTo(kScaleNum(60));
        make.height.mas_equalTo(kScaleNum(24));
    }];
    
    UIImageView *iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Shop_cell"]];
    iconImageView.frame = SARectMake(0, 0, 60, 24);
    [mongoliaView addSubview:iconImageView];
    self.iconImageView = iconImageView;
    
    UILabel *countLabel = [[UILabel alloc] init];
    countLabel.textAlignment = NSTextAlignmentCenter;
    countLabel.font = kFont(13);
    countLabel.textColor = kColor(51, 51, 51, 1);
    [mongoliaView addSubview:countLabel];
    self.countLabel = countLabel;
    [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(kScaleNum(60));
        make.centerY.offset(0);

    }];
}

-(void)loadData:(SAProductChooseColorList *)model
{
    if (model.unitName.length >0) {
        self.countLabel.text = model.unitName;
    }else
    {
        self.countLabel.text = model.attrName;
    }
    
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else {
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}

-(void)loadDat:(SAProductHomeScreeningList *)model
{
 
    self.countLabel.text = model.attrName;
    
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else {
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}

-(void)loadAccountDat:(SACurrentAccountHomeScreeningList *)model
{
    self.countLabel.text = model.name;
       
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else {
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}

-(void)payModel:(SAStatisticalAddPayModel *)model {
    
    self.countLabel.text = model.attrName;
       
    if (model.check == YES) {
        self.iconImageView.hidden = NO;
        self.mongoliaView.backgroundColor = [UIColor whiteColor];
    }else {
        self.iconImageView.hidden = YES;
        self.mongoliaView.backgroundColor = kColor(246, 246, 246, 1);
    }
}

@end

